home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 October: Mac OS SDK / Dev.CD Oct 00 SDK1.toast / Development Kits / Mac OS / AIAT / Headers / Analysis / KoreanTokenizer.h < prev    next >
Encoding:
Text File  |  1998-04-16  |  1.5 KB  |  76 lines  |  [TEXT/CWIE]

  1. // KoreanTokenizer.h
  2. //    Copyright:    © 1996 -1998 by Apple Computer, Inc., all rights reserved.
  3.  
  4. #pragma once
  5. #ifndef KoreanTokenizer_h
  6. #define KoreanTokenizer_h
  7.  
  8. #pragma import on
  9.  
  10. #if PRAGMA_STRUCT_ALIGN
  11.     #pragma options align=power
  12. #endif
  13.  
  14. #include <Script.h>                    // Macintosh platform specific include
  15.  
  16. #include "IAAnalysis.h"
  17. #include "IACharStream.h"
  18.  
  19. #pragma IA_BEGIN_EXPORTS
  20.  
  21. class KoreanDoubleByteChar
  22. {
  23. public:
  24.     KoreanDoubleByteChar(IACharStream* stream) :
  25.         code(0), len(0), kind(0),
  26.         fCharStream(stream), fScript(smKorean) {}    
  27.     ~KoreanDoubleByteChar() {}
  28.     OSErr GetNextDBChar();
  29.     short EndOfFile();
  30.     UInt32 GetCurrentPos() {return fCharStream->CurrentPos();}
  31.     
  32.     UInt16                    code;
  33.     UInt8                    len;
  34.     UInt8                    kind;
  35.     UInt32                    fScript;
  36.     IACharStream*            fCharStream;
  37. };
  38.  
  39. class KoreanTokenizer : public IATokenStream
  40. {
  41. public:
  42.     KoreanTokenizer(IACharStream* stream);
  43.     ~KoreanTokenizer(); // deletes fCharStream
  44.     
  45.     IAToken*    GetNextToken();
  46.     void        GetTextSpan(byte* buffer, uint32 startPos, uint32 endPos);
  47.     
  48.     enum KoreanTypes {  kAlphaNumeric = 0,        // Allowed anywhere in a token
  49.             kTokenPunctuation = 1,    // [,.] Allowed embedded in a token
  50.             kPunctuation = 2,        // Not allowed anywhere in a token
  51.             kWhiteSpace = 3            // Not allowed anywhere in a token
  52.     };
  53.  
  54.  
  55. private:
  56.  
  57.  
  58.     IACharStream*            fCharStream;
  59.     IAToken*    GetNextTokenInternal();
  60.     bool        BuildNextToken(StringPtr token, UInt32* startPos, UInt32* endPos);
  61.     KoreanDoubleByteChar*    fDBChar;
  62.     char*                buffer;
  63.  
  64. };
  65.  
  66.  
  67. #pragma IA_END_EXPORTS
  68.  
  69. #if PRAGMA_STRUCT_ALIGN
  70.     #pragma options align=reset
  71. #endif
  72.  
  73. #pragma import reset
  74.  
  75. #endif
  76.